package com.sc.nft.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Objects;

/**
 * @author 刘国航
 * @desc
 * @since 2024/6/14 11:24
 */
@AllArgsConstructor
@Getter
public enum PushPlatformEnum {

    IOS(1, "ios"),
    ANDROID(2, "android");

    @EnumValue
    private Integer code;
    private String desc;

    public static PushPlatformEnum fromCode(Integer code) {
        if(Objects.isNull(code)) {
            return null;
        }
        for(PushPlatformEnum pushPlatformEnum : values()) {
            if(pushPlatformEnum.getCode().equals(code)) {
                return pushPlatformEnum;
            }
        }
        return null;
    }

}
